/**
* @Title: insurance_service.js
* @Description: TODO
* Copyright: Copyright (c) 2014 
 * Company:中国平安
*
* @Project HIMS-FWA
* @author ex-xieqi001
* @date 2014年9月25日 上午10:39:31
* @version V1.0
*/
;
(function(){
	'use strict';

	var app = angular.module('fwa.services');
	app.service('InsuranceService',['$http','Modal','BaseURL',
	                  function($http,Modal,baseUrl){
		/*debugUrls = {
				queryInsuranceData: baseUrl + '',
				queryInsuranceInfo: baseUrl + 'mock/insurance/queryInsuranceInfo.json',
				updateInsuranceInfo: baseUrl + 'mock/test.json'
			},
			urls = {
			},
			serv = this;
		function getUrl(name) {
			if(debug) {
				return debugUrls[name];
			} else {
				return urls[name];
			}
		}*/
		/**获取医保服务人员列表信息**/
          this.query = function(jsonObj,callback){
              return $http({
                  url:baseUrl + '/hcpms/provider/findAttendantInfoList.do',
                  method:'GET',
                  params:jsonObj
              });
          };

		/**医疗机构**/
		this.initMedicalOrgInfoList = function(orgTypeList,medicalOrgLevelList,providerType){
			return $http({
		    	 method: "get",
		    	 url: baseUrl+'community/getNewMedicalOrgInfoList.do',
		    	 params:{
		    		 orgTypeList:orgTypeList,
		    		 medicalOrgLevelList:medicalOrgLevelList,
		    		 providerType:providerType
		    	 }
			});
		}
		
		/**查询医疗机构信息，和上面方法有点点不一样，带出来的机构等级是经过数据字典表转化过的，因为机构表中机构等级时纯的等级编码，界面显示是具体的等级：
		 * 如：一级甲等 二级甲等 三级甲等**/
        this.initMedicalOrgInfoListWithLevel = function(){
            return $http({
                 method: "get",
                 url: baseUrl+'community/getMedicalOrgInfoListWithLevel.do',
                 params:{}
            });
        }
		
		//获取单条医保服务人员详细信息
		this.queryInsuranceInfo = function(id){
			return $http({
				 method : 'GET',
				 cache : false,
		    	 url:  getUrl("queryInsuranceInfo"),
		    	 params :{
		    		 id:id
		    		 }
			});
        };
        
        //修改医保服务人员信息
        this.updateInsuranceInfo = function(data){
			return $http({
				 method : 'GET',
				 cache : false,
		    	 url:  getUrl("updateInsuranceInfo"),
		    	 params :{
		    		 name:data.name,
		    		 medicalOrg:data.medicalOrg,
		    		 orgCode:data.orgCode,
		    		 orgLevel:data.orgLevel,
		    		 orgType:data.orgType,
		    		 hosPersonType:data.hosPersonType,
		    		 qualificationLevel:data.qualificationLevel,
		    		 pcNo:data.pcNo
		    		 }
			});
        };
	}]);
	
})();